home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / Dictionary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  4.3 KB  |  163 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Dictionary.h
  3.  
  4.      Contains:    Dictionary Manager Interfaces
  5.  
  6.      Version:    Technology:    System 7
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1992-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DICTIONARY__
  18. #define __DICTIONARY__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __FILES__
  24. #include <Files.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49.  
  50.  
  51. enum {
  52.                                                                 /* Dictionary data insertion modes */
  53.     kInsert                        = 0,                            /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  54.     kReplace                    = 1,                            /* Only replace the entries which match the key with the input entry. */
  55.     kInsertOrReplace            = 2                                /* Insert the entry if there is nothing in the dictionary which matches the key, otherwise replaces the existing matched entries with the input entry. */
  56. };
  57.  
  58. /* This Was InsertMode */
  59. typedef short                             DictionaryDataInsertMode;
  60.  
  61. enum {
  62.                                                                 /* Key attribute constants */
  63.     kIsCaseSensitive            = 0x10,                            /* case sensitive = 16        */
  64.     kIsNotDiacriticalSensitive    = 0x20                            /* diac not sensitive = 32    */
  65. };
  66.  
  67.  
  68. enum {
  69.                                                                 /* Registered attribute type constants.    */
  70.     kNoun                        = -1,
  71.     kVerb                        = -2,
  72.     kAdjective                    = -3,
  73.     kAdverb                        = -4
  74. };
  75.  
  76. /* This Was AttributeType */
  77. typedef SInt8                             DictionaryEntryAttribute;
  78. /* Dictionary information record */
  79.  
  80. struct DictionaryInformation {
  81.     FSSpec                             dictionaryFSSpec;
  82.     SInt32                             numberOfRecords;
  83.     SInt32                             currentGarbageSize;
  84.     ScriptCode                         script;
  85.     SInt16                             maximumKeyLength;
  86.     SInt8                             keyAttributes;
  87. };
  88. typedef struct DictionaryInformation    DictionaryInformation;
  89.  
  90. struct DictionaryAttributeTable {
  91.     UInt8                             datSize;
  92.     DictionaryEntryAttribute         datTable[1];
  93. };
  94. typedef struct DictionaryAttributeTable    DictionaryAttributeTable;
  95. typedef DictionaryAttributeTable *        DictionaryAttributeTablePtr;
  96. EXTERN_API( OSErr )
  97. InitializeDictionary            (const FSSpec *            theFsspecPtr,
  98.                                  SInt16                 maximumKeyLength,
  99.                                  SInt8                     keyAttributes,
  100.                                  ScriptCode             script)                                THREEWORDINLINE(0x303C, 0x0500, 0xAA53);
  101.  
  102. EXTERN_API( OSErr )
  103. OpenDictionary                    (const FSSpec *            theFsspecPtr,
  104.                                  SInt8                     accessPermission,
  105.                                  SInt32 *                dictionaryReference)                THREEWORDINLINE(0x303C, 0x0501, 0xAA53);
  106.  
  107. EXTERN_API( OSErr )
  108. CloseDictionary                    (SInt32                 dictionaryReference)                THREEWORDINLINE(0x303C, 0x0202, 0xAA53);
  109.  
  110. EXTERN_API( OSErr )
  111. InsertRecordToDictionary        (SInt32                 dictionaryReference,
  112.                                  ConstStr255Param         key,
  113.                                  Handle                 recordDataHandle,
  114.                                  DictionaryDataInsertMode  whichMode)                        THREEWORDINLINE(0x303C, 0x0703, 0xAA53);
  115.  
  116. EXTERN_API( OSErr )
  117. DeleteRecordFromDictionary        (SInt32                 dictionaryReference,
  118.                                  ConstStr255Param         key)                                THREEWORDINLINE(0x303C, 0x0404, 0xAA53);
  119.  
  120. EXTERN_API( OSErr )
  121. FindRecordInDictionary            (SInt32                 dictionaryReference,
  122.                                  ConstStr255Param         key,
  123.                                  DictionaryAttributeTablePtr  requestedAttributeTablePointer,
  124.                                  Handle                 recordDataHandle)                    THREEWORDINLINE(0x303C, 0x0805, 0xAA53);
  125.  
  126. EXTERN_API( OSErr )
  127. FindRecordByIndexInDictionary    (SInt32                 dictionaryReference,
  128.                                  SInt32                 recordIndex,
  129.                                  DictionaryAttributeTablePtr  requestedAttributeTablePointer,
  130.                                  Str255                 recordKey,
  131.                                  Handle                 recordDataHandle)                    THREEWORDINLINE(0x303C, 0x0A06, 0xAA53);
  132.  
  133. EXTERN_API( OSErr )
  134. GetDictionaryInformation        (SInt32                 dictionaryReference,
  135.                                  DictionaryInformation * theDictionaryInformation)            THREEWORDINLINE(0x303C, 0x0407, 0xAA53);
  136.  
  137. EXTERN_API( OSErr )
  138. CompactDictionary                (SInt32                 dictionaryReference)                THREEWORDINLINE(0x303C, 0x0208, 0xAA53);
  139.  
  140.  
  141.  
  142.  
  143. #if PRAGMA_STRUCT_ALIGN
  144.     #pragma options align=reset
  145. #elif PRAGMA_STRUCT_PACKPUSH
  146.     #pragma pack(pop)
  147. #elif PRAGMA_STRUCT_PACK
  148.     #pragma pack()
  149. #endif
  150.  
  151. #ifdef PRAGMA_IMPORT_OFF
  152. #pragma import off
  153. #elif PRAGMA_IMPORT
  154. #pragma import reset
  155. #endif
  156.  
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160.  
  161. #endif /* __DICTIONARY__ */
  162.  
  163.